package com.ysg.widget.dialog.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ysg.R;
import com.ysg.utils.YIntUtil;
import com.ysg.widget.dialog.entity.DialogEntity;

public class DialogAdapter extends BaseQuickAdapter<DialogEntity, BaseViewHolder> {
    public DialogAdapter() {
        super(R.layout.item_dialog);
    }

    @Override
    protected void convert(BaseViewHolder holder, DialogEntity item) {
        ImageView ivIcon = holder.getView(R.id.ivIcon);
        TextView tvName = holder.getView(R.id.tvName);

        tvName.setText(item.getName());

        if (YIntUtil.thanZero(item.getIconResId())){
            ivIcon.setImageResource(item.getIconResId());
            ivIcon.setVisibility(View.VISIBLE);
        }else{
            ivIcon.setVisibility(View.GONE);
        }
    }
}
